From: Florian Müllner Date: Tue, 12 Sep 2023 12:11:55 +0000 (+0200) Subject: extensionSystem: Add 'enabled' property X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~197 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=02b19e3b5c9225f1e2cd235d698b472c59c147db;p=gnome-shell.git extensionSystem: Add 'enabled' property Unlike `state` which represents the actual state, the new property reflects the desired state, i.e. whether an extension should be enabled according to the settings. The Extension app will soon use it to improve its handling of the case where the two mismatch (e.g. extension errors). https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7004 Part-of: --- diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js index 2b7720abc..dc227801f 100644 --- a/js/misc/extensionUtils.js +++ b/js/misc/extensionUtils.js @@ -30,6 +30,7 @@ export const ExtensionState = { const SERIALIZED_PROPERTIES = [ 'type', 'state', + 'enabled', 'path', 'error', 'hasPrefs', diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 55b1e1133..10e1d92de 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -429,6 +429,7 @@ export class ExtensionManager extends Signals.EventEmitter { path: dir.get_path(), error: '', hasPrefs: dir.get_child('prefs.js').query_exists(null), + enabled: this._enabledExtensions.includes(uuid), hasUpdate: false, canChange: false, sessionModes: meta['session-modes'] ? meta['session-modes'] : ['user'], @@ -609,6 +610,13 @@ export class ExtensionManager extends Signals.EventEmitter { async _onEnabledExtensionsChanged() { let newEnabledExtensions = this._getEnabledExtensions(); + for (const extension of this._extensions.values()) { + const wasEnabled = extension.enabled; + extension.enabled = newEnabledExtensions.includes(extension.uuid); + if (wasEnabled !== extension.enabled) + this.emit('extension-state-changed', extension); + } + // Find and enable all the newly enabled extensions: UUIDs found in the // new setting, but not in the old one. const extensionsToEnable = newEnabledExtensions